package org.clockworkmages.games.anno1186.gui;

import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JComponent;

public class AnimatedSlidingInImage
		extends AnimatedImage {

	public AnimatedSlidingInImage(Image image) {
		super(image);
	}

	@Override
	public void draw(Graphics g, JComponent panel) {

		double x = 0.5d * panel.getWidth()
		// center the image at the center of the panel
				- getImage().getWidth(null) / 2;
		double y = panel.getHeight() - getImage().getHeight(null) * getState();

		g.drawImage(getImage(), (int) x, (int) y, null);
	}
}
